package pers.gxm.singleton;

public class TicketMaker {
    public static void main(String[] args) {
        TicketMaker ticketMaker = TicketMaker.getInstance();
        int number = ticketMaker.getNextTicketNumber();
        System.out.println("number = " + number);

    }
    private static TicketMaker ticketMaker = new TicketMaker();
    private TicketMaker(){}
    public static TicketMaker getInstance(){
        return ticketMaker;
    }
    private int ticket = 0;
    public int getNextTicketNumber(){
        return ++ticket;
    }
}
